﻿package common.components.transition.transitions.mask
{
	import common.BaseCons;
	import common.components.transition.events.TransitionEvent;
	import common.components.transition.transitions.TransitionRunner;
	
	import flash.events.Event;
	import flash.events.TimerEvent;
	import flash.utils.Timer;
	
	import mx.controls.Image;
	
	public class Round extends Mask
	{	
		public function Round(runner:TransitionRunner,image:Image,transTime:Number,stayTime:Number) 
		{
			super(runner,image,transTime,stayTime);
			this.maskId = BaseCons.TRANS_TYPE_ROUND;
		}
	
		override protected function transInStart() : void
		{
			super.transInStart();
//			this.mask.x = 0;
//			this.mask.y = 0;
//			this.mask.scaleX = 1.5;
//			this.mask.scaleY = 1.5;
			
			var timer:Timer = new Timer(1500,1);
			timer.addEventListener(TimerEvent.TIMER_COMPLETE,this.onMaskInEnd);
			timer.start();
			
//			var direction : Number = Math.pow((-1),Math(10));
//			this.mask.x = -200+direction*60*Math.random();
//			this.mask.y = -150;
		}
		
		private function onMaskInEnd(evt:Event):void
		{
			this.dispatchEvent(new TransitionEvent(TransitionEvent.TRANS_IN_END));
		}
	}
}